package com.redsoil.house.ui.mine.adapter;

import android.graphics.Paint;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.redsoil.house.R;
import com.redsoil.house.base.BaseViewHolderTSK;
import com.redsoil.house.model.bean.ProductsVO;
import com.redsoil.house.model.bean.TestVO;
import com.redsoil.house.model.http.api.ApiConstants;
import com.weidingqiang.rxfiflibrary2.app.AppConstants;

import java.util.List;

/**
 * Created by weidingqiang on 2018/12/20.
 */

public class MineSpecialAdapter extends BaseQuickAdapter<ProductsVO.DataListBean,BaseViewHolderTSK> {

    public MineSpecialAdapter(int layoutResId, List<ProductsVO.DataListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolderTSK helper, ProductsVO.DataListBean item) {

        helper.setText(R.id.goods_title_tv,item.getName());

        helper.setText(R.id.goods_info_tv,item.getIntro());

        helper.setText(R.id.goods_num_tv,String.format("数量:仅剩余%d套", item.getStockQuantity()) );

        helper.setText(R.id.goods_old_price_tv,"原价: "+item.getOriginalPrice());

        helper.setText(R.id.goods_price_tv,item.getCurrentPrice()+"");

        TextView goods_old_price_tv = helper.getView(R.id.goods_old_price_tv);
        goods_old_price_tv.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );

//        goods_img
        Glide.with(mContext)
                .load(ApiConstants.STATIC_FILE+item.getPic())
                .centerCrop()
                .into((ImageView)helper.getView(R.id.goods_img));
    }
}
